<!doctype html>
<html class="no-js">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>个人详情</title>
    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">
    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--<meta name="format-detection" content="telephone = no" />-->
    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="个人详情" />
    <meta name="msapplication-TileColor" content="#090a0a">
    <script src="__ROOT__/static/home/css/userInfo/layer.mobile-v2.0/layer_mobile/layer.js"></script>
    <script src="__ROOT__/static/home/js/jquery-1.11.1.min.js"></script>
    <link href="__ROOT__/static/home/css/userInfo/layer.mobile-v2.0/layer_mobile/need/layer.css" rel="stylesheet"/>
    <link href="__ROOT__/static/home/css/userInfo/css/mui.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="__ROOT__/static/home/css/userInfo/css/style.css" />
    <link rel="stylesheet" href="__ROOT__/static/home/css/userInfo/css/top_nav.css" />
</head>
<script>
  //图片上传
    function dian(){

        var formData=new FormData($('#upload')[0]);
        $.ajax({

                    cache: false,
                    type: "POST",
                    url:"{:url('home/Userinfo/getAvatar')}",
                    data:formData,
                    async:false,
                    contentType:false,
                    processData:false,
                    success:function(data){
                        //把上传路径写到数据库
                        var params={};
                        params.avatarPath=data;
                       if(params.avatarPath){
                           $.ajax({
                               cache:true,
                               type:'POST',
                               url:"{:url('home/Userinfo/saveAvatar')}",
                               data:params,
                               async:false,
                               success:function(redata){
                                   if(redata==1){
                                       layer.open({
                                       content: '修改成功'
                                       ,skin: 'msg'
                                       ,time: 2 //2秒后自动关闭
                                   })
                                     window.location.reload();
                                   }else{
                                       layer.open({
                                           content: '修改失败'
                                           ,skin: 'msg'
                                           ,time: 2 //2秒后自动关闭
                                       })
                                   }

                               }
                           });
                       }
                    }
                }
        );
  }
</script>
<style>
    /*选择图片样式*/
    .img{
        opacity:0;
        position: absolute;
        right: 0;
        top: 0;
        filter: alpha(opacity=0);
        cursor: pointer;
        font-size: 100px;
    }
</style>


<body>
<div style="height: 50px;background-color: powderblue;">
    <div class="top_nav" style=""><a href="{:url('home/Userinfo/index')}">< 返回</a></div>
    <div class="top_navC">个人资料</div>
    <div class="top_nav"></div>
</div>
<div class="member-top">
    <div class="header-r">
        <a href=""><i class="iconfont"></i></a>
    </div>
    <div class="member-info">
        <div class="user-avatar"><a href=""><img src="__ROOT__/{if condition="!empty($userInfo['avatar_url'])"}{$userInfo['avatar_url']}{else /}static/home/css/userInfo/images/default_user_portrait_0.png{/if}"></a></div>
        <div class="user-name"><span>{$userInfo['nickname']}<sup>注册会员</sup></span></div>
    </div>

</div>
<div class="user-order-box">
	<form action="" method="post" id="upload" enctype="multipart/form-data">

    <a href="javascript:;" class="h_img">
    <dl>
            <dt>
                <strong><input type="file" name="img" onchange="dian()" class="img">修改头像</strong>
            </dt>
    </dl>
    </a>
	</form>
    <a href="{:url('home/Userinfo/updateName')}">
    <dl>
            <dt>
                <strong>修改昵称</strong>
            <p>&emsp;&emsp;&emsp;&emsp;&emsp;{$userInfo['nickname']}</p>
            </dt>
    </dl>
    </a>
    <a href="{:url('home/Userinfo/updatePassword')}">
    <dl>
            <dt>
                <strong>修改密码</strong>
            </dt>
    </dl>
    </a>
    <a href="{:url('home/Userinfo/updateSex')}">

    <dl>
            <dt>
            <strong>修改性别</strong>

            <p>&emsp;&emsp;&emsp;&emsp;&emsp;{if condition="$userInfo['sex'] ==1"}男{elseif condition="$userInfo['sex']==2"/}女{elseif condition="$userInfo['sex']==0"/}保密{/if}</p>
            </dt>
    </dl>
    </a>
    <a href="{:url('home/Userinfo/updatePhone')}">
    <dl>
            <dt>
                <strong>修改电话</strong>
            <p>&emsp;&emsp;&emsp;&emsp;&emsp;{$userInfo['phone']}</p>

            </dt>
    </dl>
    </a>
    <a href="{:url('home/Userinfo/updateEmail')}">

    <dl>
            <dt>
                <strong>修改E-mail</strong>
            <p>&emsp;&emsp;&emsp;&emsp;{$userInfo['email']}</p>

            </dt>
    </dl>
    </a>

</div>
<div style="height: 50px"></div>

</body>
</html>
